<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script src="https://cdn.bootcss.com/socket.io/2.3.0/socket.io.js"></script>
<script>
  var socket = io('ws://127.0.0.1:9501', { transports: ["websocket"] });
  socket.on('connect', data => {
    socket.emit('event', 'hello, hyperf', console.log);
    socket.emit('join-room', 'room1', console.log);
    socket.emit('join-room', 'room2', console.log);
    setInterval(function () {
      socket.emit('say', '{"room":"room1", "message":"Hello Hyperf."}');
    }, 5000);
  });
  socket.on('event', console.log);
</script>

</body>
</html>
